package com.burns.rbac.context;

import com.burns.rbac.entity.UserToken;

/**
 * 用ThreadLocal来管理用户信息
 */
public class UserContextHolder {
    private static ThreadLocal<UserToken> tokenThreadLocal = new ThreadLocal<>();

    public static void set(UserToken userToken) {
        tokenThreadLocal.set(userToken);
    }

    public static UserToken get() {
        return tokenThreadLocal.get();
    }

    public static void remove(){
        tokenThreadLocal.remove();
    }
}
